import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router';
import routes from './routes';
import permission from './routesPermission';

export default Promise.all(routes).then((routes) => {
    const router = createRouter({
        history: createWebHashHistory(process.env.BASE_URL),
        routes
    });

    permission.redirectRoutes(router);

    permission.nprogress(router);

    document.title = '闲云野鹤';

    return router;
});
